/**
 * Message Classes
 * Copyright (C) 2009 Hajime Yoshimori <RoarLudros@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <DragonMessage>
#include <DragonInit>

#include <config.h>

// for avoid dragon::_() .
#define _(msg) (msg)

using namespace std;

namespace dragon {
  const DragonMessage msgCommandNotFound
  = DragonMessage(DragonMessage::error,
				  _("Command not found."),
				  _("I don't know that command."));
	
  const DragonMessage msgCharConvError
  = DragonMessage(DragonMessage::error,
				  _("Charactor conversion failed."),
				  _("I think that the conversion of the internal expression of the string failed."));
  
  const DragonMessage msgMemoryIsFull
  = DragonMessage(DragonMessage::error,
				  _("Memory allocation error."),
				  _("There aren\'t enough board space to do this."));
  
  const DragonMessage msgUnknownOption
  = DragonMessage(DragonMessage::error,
				  _("Unknown option."), 
				  _("I couldn\'t recognize that option."));
				  
  const DragonMessage msgParRequired
  = DragonMessage(DragonMessage::error,
				  _("Requires the parameter."), 
				  _("That option is required the parameter."));

  const DragonMessage msgMaybeBug
  = DragonMessage(DragonMessage::error,
				  _("This may be a bug. Please report to us."), 
				  _("Here is a \"dragon\". You should report to technical support."));
}

dragon::DragonMessage::~DragonMessage() {
  
}

dragon::DragonMessage::DragonMessage() {
  type = DragonMessage::error;
  normal_msg = _("Unknown error.");
  dragon_msg = _("I think that it has some unspecificable problems.");
}

dragon::DragonMessage::DragonMessage(msg_type t, 
									 const std::string& n_msg, 
									 const std::string& d_msg) {
  type = t;
  normal_msg = n_msg;
  dragon_msg = d_msg;
}

// remove definition.
#undef _

std::string dragon::DragonMessage::getMessage(msg_word word) const throw() {
  switch(word) {
	case dragon:
	  return d_(dragon_msg);
	case normal:
	default:
	  return d_(normal_msg);
  }
}

dragon::DragonMessage::msg_type dragon::DragonMessage::getType() const throw() {
  return type;
}
